<template>
	<view :style="themeColor">
		<view class="page">
			<view class="flex benben-position-layout flex flex-wrap align-center cardDetails_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }"
				v-if=" appSystemIdentification!='Wechat'">
				<view class='flex flex-wrap align-center justify-between flex-sub cardDetails_fd0_0'>
					<view class='flex flex-wrap align-center cardDetails_fd0_0_c0' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">
						<text class='fu-iconfont2  cardDetails_fd0_0_c0_c0'>&#xe794;</text>
					</view>
					<text class='cardDetails_fd0_0_c1'>套餐详情</text>
					<view class='flex flex-wrap align-center cardDetails_fd0_0_c0'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}" v-if=" appSystemIdentification!='Wechat'"></view>
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout cardDetails_flex_1">
				<view style="position: relative">
					<swiper ref="benbenSwiperfd1_0" @change="bannerIndexfd1_0 = $event.detail.current"
						class='flex position-relative cardDetails_fd1_0' previous-margin="0rpx" next-margin="0rpx"
						:display-multiple-items="1" :interval="5000" :duration="500" :autoplay='true' :circular='true'>

						<template v-for='(item,key0) in detailsData.picture'>
							<swiper-item class='flex  cardDetails_fd1_0' :key='key0'>
								<image class='cardDetails_fd1_0_c1_c0' mode="aspectFill" :src='item'
									@tap.stop="multiImagePreview(item,detailsData.picture,'')"></image>
							</swiper-item>
						</template>

					</swiper>
					<view style="position: absolute"
						class="flex dot flex align-center justify-center cardDetails_swiperDotfd1_0">
						<template v-for="(item, index) in (detailsData.picture.length)">
							<view :key="index" v-if="bannerIndexfd1_0 == index"
								class="flex dot selected flex align-center justify-center cardDetails_swiperDotSelectedfd1_0">
							</view>
							<view :key="index" v-else
								class="flex dot unselected flex align-center justify-center cardDetails_swiperDotUnselectedfd1_0">
							</view>
						</template>
					</view>
				</view>
				<view class='flex flex-wrap align-center self-center cardDetails_fd1_1'>
					<text class='self-start cardDetails_fd1_1_c0'>￥</text>
					<text class=' cardDetails_fd1_1_c1'>
						<text>{{ detailsData.meal_price | frontPrice }}</text>
						<text class=' cardDetails_price2_fd1_1_c1'>{{ detailsData.meal_price | laterPrice }}</text>
					</text>
					<text class='cardDetails_fd1_1_c2'>服务总价值</text>
					<text class='self-start cardDetails_fd1_1_c3'>￥</text>
					<text class='cardDetails_fd1_1_c4'>{{detailsData.scribe_money}}</text>
					<text class='cardDetails_fd1_1_c5'>已售</text>
					<text class='cardDetails_fd1_1_c6'>{{detailsData.sale_num}}</text>
					<text class='cardDetails_fd1_1_c6'>单</text>
				</view>
				<text class='flex-sub cardDetails_fd1_2'>{{detailsData.service_meal_name}}</text>
				<view class='flex flex-wrap align-center cardDetails_fd1_3'>
					<view class='flex flex-wrap align-center cardDetails_fd1_3_c0' @tap.stop="handleJumpDiy"
						data-type="navigateTo" :data-url="`/pages/my/optionCity/optionCity?id=${detailsData.aid}`">
						<text class='cardDetails_fd1_3_c0_c0'>服务城市：</text>
						<text class='cardDetails_fd1_3_c0_c0'>{{cityData.name||'请选择城市'}}</text>
						<image class='cardDetails_fd1_3_c0_c2' mode="aspectFill" :src='STATIC_URL+"485.png"'></image>
					</view>
				</view>
			</view>

			<!---flex布局flex布局结束-->
			<!---flex布局flex布局开始-->
			<view class="flex benben-flex-layout flex-wrap align-center cardDetails_flex_2">
			</view>

			<!---flex布局flex布局结束-->
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout cardDetails_flex_3">
				<text class='cardDetails_fd3_0'>套餐包含服务</text>
				<template v-for='(item,key0) in detailsData.specs_name'>
					<view class='flex flex-wrap align-center cardDetails_fd3_1' :key='key0'>
						<view class='flex flex-wrap align-center cardDetails_fd3_1_c0'>
						</view>
						<text class='flex-sub cardDetails_fd3_1_c1'>{{item.name}}</text>
						<text class='cardDetails_fd3_1_c2'>{{detailsData.number}}</text>
						<text class='cardDetails_fd3_1_c3'>次</text>
					</view>
				</template>
			</view>
			<!---flex布局flex布局结束-->
			<!---flex布局flex布局开始-->
			<view class="flex benben-flex-layout flex-wrap align-center cardDetails_flex_4">
			</view>

			<!---flex布局flex布局结束-->
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout cardDetails_flex_5">
				<view class='flex flex-wrap align-center justify-center cardDetails_fd5_0'>
					<view class='flex flex-wrap align-center cardDetails_fd5_0_c0'>
					</view>
					<text class='cardDetails_fd5_0_c1'>详情</text>
					<view class='flex flex-wrap align-center cardDetails_fd5_0_c0'>
					</view>
				</view>
				<jyf-parser class='cardDetails_fd5_1' :html="detailsData.service_details | richTextFormat">
				</jyf-parser>
			</view>

			<!---flex布局flex布局结束-->
			<view class="flex flex-wrap align-center justify-end benben-position-layout flex cardDetails_flex_6">
				<button class='flex-sub cardDetails_fd6_0' @tap.stop="postJumpFunc()">立即抢购</button>

			</view>
			<view :style="{height: '120rpx'}"></view>


		</view>
	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},


		data() {
			return {
				"bannerIndexfd1_0": 0,
				"submit": {
					"zhifubianhao": "",
					"zhifujine": "",
					"countdown": ""
				},
				"detailsData": {
					"service_meal_name": "",
					"meal_price": "",
					"number": "",
					"valid_time": "",
					"scribe_money": "",
					"subtitle": "",
					"picture": [],
					"service_details": "",
					"serviceproject_id": "",
					"sale_num": "",
					"specs_name": "",
					"aid": "",
					"serviceprojectspecs_id": "",
					"image": "",
					"city": ""
				},
				"cityData": {
					"id": "",
					"name": ""
				},
				"id": ""
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},
			/**
			 * @returns 
			 * Android       安卓
			 * IOS       苹果
			 * Web       H5 或 pc
			 * Wechat       微信小程序
			 * Alipay       支付宝小程序
			 * Baidu       百度小程序
			 * ByteBounce       抖音小程序
			 * 360       360小程序
			 * FastApp       快应用
			 */
			appSystemIdentification() {
				return this.$store.state.appSystemIdentification
			}
		},
		watch: {},
		onLoad(options) {
			let {
				id
			} = options
			if (id !== undefined) this.id = id
			this.getDetailsFunc()
			this.diyPageListen()
			uni.showShareMenu({
				withShareTicket: true,
				//设置下方的Menus菜单，才能够让发送给朋友与分享到朋友圈两个按钮可以点击
				menus: ["shareAppMessage", "shareTimeline"]
			})
		},
		onUnload() {
			this.diyOffPageListen()
		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onShareAppMessage() {
			return {
				title: '高整无忧-数字家政平台',
				// path: `/pages/index/classify/classify?pid=${this.pid}&name=${this.name}`
				path: `/pages/my/cardDetails/cardDetails?id=${this.id}`
			}
		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//获取次卡服务详情信息
			async getDetailsFunc() {
				//请求方法
				//数据验证

				let datadetailsData = await this.$api.get(global.apiUrls.post653383d0d6f4a, {
					aid: this.id
				});

				if (datadetailsData.data.code != 1) {
					this.$message.info(datadetailsData.data.msg);
					return
				}
				let infodetailsData = datadetailsData.data;
				this.detailsData = infodetailsData.data

			},
			//提交下单
			async postJumpFunc() {
				if (!validate(this.cityData.id, 'require')) {
					this.$message.info('请选择服务城市');
					return false;
				}
				//请求方法
				//数据验证

				let datasubmit = await this.$api.dbPost(global.apiUrls.post65336d93cb982, {
					aid: this.id,
					city_id: this.cityData.id,
					city_name: this.cityData.name
				});
				if (!datasubmit) return
				if (datasubmit.data.code != 1) {
					this.$message.info(datasubmit.data.msg);
					return
				}
				let infosubmit = datasubmit.data;
				this.submit = infosubmit.data

				this.$urouter.navigateTo(
					`/pages/my/payCar/payCar?money=${this.submit.zhifujine}&countdown=${this.submit.countdown}&orde_sn=${this.submit.zhifubianhao}&order_type=18`
				);
			},
			//页面监听
			diyPageListen() {
				uni.$on('cityData', (data) => {
					this.cityData = data;
					this.getDetailsFunc()
				});
			},
			//注销页面监听
			diyOffPageListen() {
				uni.$off('cityData');
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: rgba(255, 255, 255, 1);
		background-size: 100% auto;
	}

	.cardDetails_flex_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.cardDetails_fd0_0_c1 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333;
	}

	.cardDetails_fd0_0_c0_c0 {
		font-size: 32rpx;
		color: #333;
	}

	.cardDetails_fd0_0_c0 {
		width: 120rpx;
		height: 88rpx;
	}

	.cardDetails_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		height: 88rpx;
	}

	.cardDetails_flex_1 {
		background: #fff;
		background-size: 100% auto !important;
		margin: 0rpx 0rpx 30rpx 0rpx;
	}

	.cardDetails_fd1_3_c0_c2 {
		width: 16rpx;
		height: 16rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 0rpx 0rpx 8rpx;
	}

	.cardDetails_fd1_3_c0_c0 {
		font-size: 24rpx;
		font-weight: 400;
		color: #333;
		line-height: 33rpx;
	}

	.cardDetails_fd1_3_c0 {
		border: 1px solid #eee;
		padding: 10rpx 16rpx 10rpx 16rpx;
		border-radius: 24rpx;
	}

	.cardDetails_fd1_3 {
		margin: 32rpx 24rpx 0rpx 24rpx;
	}

	.cardDetails_fd1_2 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 700;
		margin: 0rpx 24rpx 0rpx 24rpx;
		line-height: 40rpx;
	}

	.cardDetails_fd1_1_c6 {
		color: #999999;
		font-size: 24rpx;
		line-height: 30rpx;
	}

	.cardDetails_fd1_1_c5 {
		color: #999999;
		font-size: 24rpx;
		line-height: 30rpx;
		margin: 0rpx 0rpx 0rpx auto;
	}

	.cardDetails_fd1_1_c4 {
		color: #999999;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 33rpx;
	}

	.cardDetails_fd1_1_c3 {
		color: rgba(153, 153, 153, 1);
		font-size: 22rpx;
		font-weight: 400;
	}

	.cardDetails_fd1_1_c2 {
		margin: 0rpx 0rpx 0rpx 16rpx;
		color: #999999;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 33rpx;
	}

	.cardDetails_price2_fd1_1_c1 {
		font-size: 24rpx;
	}

	.cardDetails_fd1_1_c1 {
		color: var(--benbenbgColor2);
		font-weight: 600;
		font-size: 32rpx;
	}

	.cardDetails_fd1_1_c0 {
		color: var(--benbenbgColor2);
		font-size: 22rpx;
		font-weight: 700;
		margin-top: 3rpx;
	}

	.cardDetails_fd1_1 {
		margin: 30rpx 24rpx 32rpx 24rpx;
	}

	.cardDetails_numberfd1_0_c0 {
		background: #525050;
		position: absolute;
		bottom: 20rpx;
		right: 30rpx;
		width: 80rpx;
		height: 40rpx;
		border-radius: 6rpx 6rpx 6rpx 6rpx;
		font-size: 24rpx;
		color: #FFFFFF;
		line-height: 46rpx;
		font-weight: 400;
	}

	.cardDetails_fd1_0_c1_c0 {
		width: 750rpx;
		height: 500rpx;
		border-radius: 0rpx;
	}

	.cardDetails_fd1_0 {
		width: 750rpx;
		height: 500rpx;
	}

	.cardDetails_swiperDotUnselectedfd1_0 {
		background: rgba(255, 255, 255, 0.5);
		width: 12rpx;
		height: 6rpx;
		border-radius: 3rpx 3rpx 3rpx 3rpx;
		margin: 0rpx 10rpx 0rpx 0rpx;
		font-size: 24rpx;
		color: #fff;
	}

	.cardDetails_swiperDotSelectedfd1_0 {
		border: 1px solid var(--benbenbdColor1);
		background: #fff;
		width: 22rpx;
		height: 6rpx;
		border-radius: 3rpx 3rpx 3rpx 3rpx;
		margin: 0rpx 10rpx 0rpx 0rpx;
	}

	::v-deep .cardDetails_swiperDotfd1_0 {
		position: absolute;
		bottom: 20rpx;
		left: 0rpx;
		right: 0rpx;
	}

	.cardDetails_flex_2 {
		background: rgba(248, 248, 248, 1);
		height: 10rpx;
		background-size: 100% auto;
	}

	.cardDetails_flex_3 {
		background: #fff;
		background-size: 100% auto !important;
		padding: 24rpx 24rpx 24rpx 24rpx;
	}

	.cardDetails_fd3_1_c3 {
		font-size: 32rpx;
		font-weight: 500;
		color: #333;
	}

	.cardDetails_fd3_1_c2 {
		margin: 0rpx 0rpx 0rpx auto;
		font-size: 32rpx;
		font-weight: 600;
		color: var(--benbenFontColor4);
	}

	.cardDetails_fd3_1_c1 {
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
		line-height: 40rpx;
		margin: 0rpx 40rpx 0rpx 0rpx;
	}

	.cardDetails_fd3_1_c0 {
		background: var(--benbenbgColor2);
		width: 10rpx;
		height: 10rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
		border-radius: 5rpx;
		background-size: 100% auto;
	}

	.cardDetails_fd3_1 {
		background: rgba(248, 248, 248, 1);
		border-radius: 16rpx;
		background-size: 100% auto;
		padding: 32rpx 24rpx 32rpx 24rpx;
		margin-bottom: 20rpx;
	}

	.cardDetails_fd3_0 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 700;
		line-height: 45rpx;
		margin: 0rpx 0rpx 24rpx 0rpx;
	}

	.cardDetails_flex_4 {
		background: rgba(248, 248, 248, 1);
		height: 10rpx;
		background-size: 100% auto;
	}

	.cardDetails_flex_5 {
		background: #fff;
		background-size: 100% auto !important;
	}

	::v-deep .cardDetails_fd5_1 {
		margin: 0rpx 24rpx 0rpx 24rpx;
	}

	.cardDetails_fd5_0_c1 {
		font-size: 32rpx;
		font-weight: 700;
		color: #333333;
		margin: 0rpx 34rpx 0rpx 34rpx;
		line-height: 45rpx;
	}

	.cardDetails_fd5_0_c0 {
		background: rgba(225, 225, 225, 1);
		background-size: 100% auto !important;
		width: 64rpx;
		height: 1rpx;
	}

	.cardDetails_fd5_0 {
		margin: 32rpx 0rpx 0rpx 0rpx;
	}

	.cardDetails_flex_6 {
		background: #fff;
		width: 750rpx;
		height: 120rpx;
		overflow: hidden;
		z-index: 10;
		bottom: calc(0rpx + var(--window-bottom));
		background-size: 100% auto !important;
	}

	.cardDetails_fd6_0 {
		background: var(--benbenbgColor2);
		border-radius: 54rpx 54rpx 54rpx 54rpx;
		font-size: 28rpx;
		color: #fff;
		width: 590rpx;
		height: 80rpx;
		line-height: 80rpx;
		font-weight: 400;
		margin: 0rpx 20rpx 0rpx 24rpx;
	}
</style>